<?php
/**
 * Description of sqlclass
 *
 * @author mavr
 * ./db
 */
class sqlclass
{
    function CreateSqlClass ()
    {
        $conf = $this->configuredb();

        switch ($conf->db)
        {
            case "mysql":   include_once "db/mysql.php"; break;

        }

        $sql = new sql_db($conf->dbhost,$conf->dbuser,$conf->dbpasswd,$conf->dbmain);

        return $sql;
    }

    function configuredb()
    {
        $file = $_SERVER['DOCUMENT_ROOT']."/svn/crm/conf/configdb.xml";
        $xmlfile = file_get_contents($file);
        $xml = new SimpleXMLElement($xmlfile);

        $output->db = $xml->UseDateBase->use;
        $output->dbhost = $xml->DateBaseConfig->host;
        $output->dbuser = $xml->DateBaseConfig->user;
        $output->dbpasswd = $xml->DateBaseConfig->passwd;
        $output->dbmain = $xml->UseDateBases->main;

        return $output;
    }
}
?>
